<style>
	.datagrid-cell button, .datagrid-cell input, .datagrid-cell optgroup, .datagrid-cell select, .datagrid-cell textarea{
		color:#000;
	}
</style>
<taglib name="Admin\TagLib\EasyUI" />
<easyui:propertygrid options="propertygrid.options" />

<script type="text/javascript">
var setting_site_propertygrid_id = 'setting_site_propertygrid';
var setting_site_propertygrid_toolbar = [
	{ text: '保存', iconCls: 'icons-other-disk', handler: settingSiteSave },
	{ text: '刷新', iconCls: 'icons-arrow-arrow_refresh', handler: settingSiteRefresh },
	{ text: '恢复默认', iconCls: 'icons-other-cog', handler: settingSiteDefault }
];
//保存
function settingSiteSave(){
	var data = [];
	var rows = $('#'+setting_site_propertygrid_id).propertygrid('getChanges');
	for(var i=0; i<rows.length; i++){
		data.push({'key': rows[i]['key'], 'value': rows[i]['value']});
	}
	$.post("{:U('Setting/site?dosubmit=1')}", {data: data}, function(res){
		if(!res.status){
			$.messager.alert('提示信息', res.info, 'error');
		}else{
			$.messager.alert('提示信息', res.info, 'info');
		}
	}, 'json');
}
//刷新
function settingSiteRefresh(){
	$('#'+setting_site_propertygrid_id).propertygrid('reload');
}
//恢复默认
function settingSiteDefault(){
	$.messager.confirm('提示信息', '确定要恢复出厂设置吗？', function(result){
		if(!result) return true;
		$.post("{:U('Setting/siteDefault')}", function(res){
			if(!res.status){
				$.messager.alert('提示信息', res.info, 'error');
			}else{
				$.messager.alert('提示信息', res.info, 'info');
				settingSiteRefresh();
			}
		}, 'json');
	})
}
</script>
